import Vue from "vue";
import VueRouter from "vue-router";


import Login from "../views/login.vue";
import Doctor from "../views/doctorSystem.vue";
import Admin from  '../views/teach.vue'



//管理员用户管理
import GuanUser from "@/views/GuanUser/index.vue";
import GuanUserData from "@/views/GuanUser/list.vue"

import Guanread from "../views/guanliyuanead/index.vue"
import GuanreadList from "../views/guanliyuanead/counsel_list.vue"

import Guanliyuan from "../views/guanliyuan/index.vue"
import GuanliyuanList from "../views/guanliyuan/counsel_list.vue"

import GuanliyuanPls from "@/views/guanliyuanPls/index.vue";
import GuanliyuanPlsList from "@/views/guanliyuanPls/counsel_list.vue"

import GuanliTeacher from "@/views/GuanliTeacher/index.vue";
import GuanliTeacherList from "@/views/GuanliTeacher/counsel_list.vue"

import guanliyuaneadCell from "@/views/guanliyuaneadCell/index.vue"
import guanliyuaneadCellList from "@/views/guanliyuaneadCell/counsel_list.vue"

import GGread from "@/views/GGread/index.vue";
import GGreadList from "@/views/GGread/counsel_list.vue"

import GClass from "@/views/GClass/index.vue";
import GClasslist from "@/views/GClass/counsel_list.vue"





import GuanliStudent from "@/views/GuanliStudent/index.vue";
import GuanliStudentList from "@/views/GuanliStudent/counsel_list.vue"



import TeaPage from "@/views/TeaPage/index.vue";
import TeaPageList from "@/views/TeaPage/detail.vue"




import GuanliStudentCla from "@/views/GuanliStudentCla/index.vue";
import GuanliStudentClaList from "@/views/GuanliStudentCla/counsel_list.vue"

import GuanYueduCell from "@/views/GuanYueduCell/index.vue";
import GuanYueduCellList from "@/views/GuanYueduCell/counsel_list.vue"



import GuanliT from "@/views/GuanliT/index.vue";
import GuanliTList from "@/views/GuanliT/counsel_list.vue"
import GuanYuedu from "@/views/GuanYuedu/index.vue";
import GuanYueduDetail from "@/views/GuanYuedu/counsel_list.vue"

import Gkaoqin from "@/views/Gkaoqin/index.vue";
import GkaoqinList from "@/views/Gkaoqin/counsel_list.vue"

import register from "../views/register.vue";
import consumerSystem from "../views/userSystem.vue";
import notice from '../views/Notice.vue'
import homePage from '../views/homePage/index.vue'
import homePageIndex from '../views/homePage/detail.vue'

Vue.use(VueRouter);

const routes = [{
    path: "/",
    redirect: "/login",
},
{
    path: "/login",
    name: "login",
    component: Login,
},
{
    path: "/admin",
    name: "doctor",
    component: Doctor,

    children: [
    {
        path: "notice",
        component: notice,
    },

    {
        path: "guanliyuan",
        component: Guanliyuan,
        redirect: "/admin/guanliyuan/list",
        children: [{
                path: "list",
                component: GuanliyuanList,
            },

        ],
    },
        {
            path: "guanliyuanead",
            component: Guanread,
            redirect: "/admin/guanliyuanead/list",
            children: [{
                path: "list",
                component: GuanreadList ,
            },

            ],
        },
        {
            path: "guanliyuaneadCell",
            component: guanliyuaneadCell,
            redirect: "/admin/guanliyuaneadCell/list",
            children: [{
                path: "list",
                component: guanliyuaneadCellList ,
            },

            ],
        },
        {
            path: "GuanYuedu",
            component: GuanYuedu,
            redirect: "/admin/GuanYuedu/list",
            children: [{
                path: "list",
                component: GuanYueduDetail ,
            },

            ],
        }, {
            path: "GuanYueduCell",
            component: GuanYueduCell,
            redirect: "/admin/GuanYueduCell/list",
            children: [{
                path: "list",
                component: GuanYueduCellList ,
            },

            ],
        },
        {
            path: "Gkaoqin",
            component: Gkaoqin,
            redirect: "/admin/Gkaoqin/list",
            children: [{
                path: "list",
                component: GkaoqinList ,
            },

            ],
        },
        {
            path: "GGread",
            component: GGread,
            redirect: "/admin/GGread/list",
            children: [{
                path: "list",
                component: GGreadList,
            },

            ],
        },
        {
            path: "GClass",
            component: GClass,
            redirect: "/admin/GClass/list",
            children: [{
                path: "list",
                component: GClasslist ,
            },

            ],
        },




        {
            path: "GuanUser",
            component: GuanUser,
            redirect: "/admin/GuanUser/list",
            children: [{
                path: "list",
                component: GuanUserData,
            },
            ],
        },
        {
            path: "GuanliTeacher",
            component:GuanliTeacher,
            redirect: "/admin/GuanliTeacher/list",
            children: [{
                path: "list",
                component: GuanliTeacherList ,
            },

            ],
        },
        {
            path: "GuanliStudent",
            component:GuanliStudent,
            redirect: "/admin/GuanliStudent/list",
            children: [{
                path: "list",
                component: GuanliStudentList ,
            },

            ],
        },
        {
            path: "GuanliStudentCla",
            component:GuanliStudentCla,
            redirect: "/admin/GuanliStudentCla/list",
            children: [{
                path: "list",
                component: GuanliStudentClaList ,
            },

            ],
        },
        {
            path: "TeaPage",
            component: TeaPage,
            redirect: "/admin/TeaPage/list",
            children: [{
                path: "list",
                component:  TeaPageList,
            },

            ],
        },


    ],
},
{
    path: "/consumer",
    name: "consumer",
    component: consumerSystem,
    redirect: "/consumer/notice",
    children: [
        {
            path: "notice",
            component: notice,
        },
        {
            path: "homePage",
            component: homePage,
            redirect: "/consumer/homePage/detail",
            children: [{
                    path: "detail",
                    component: homePageIndex,
                },

            ],
        },

        {
            path: "GuanYuedu",
            component: GuanYuedu,
            redirect: "/consumer/GuanYuedu/list",
            children: [{
                path: "list",
                component: GuanYueduDetail,
            },

            ],
        },
        {
            path: "GuanYueduCell",
            component:  GuanYueduCell,
            redirect: "/consumer/GuanYueduCell/list",
            children: [{
                path: "list",
                component:  GuanYueduCellList ,
            },

            ],
        },

        {
            path: "Gkaoqin",
            component: Gkaoqin,
            redirect: "/consumer/Gkaoqin/list",
            children: [{
                path: "list",
                component: GkaoqinList ,
            },

            ],
        },
        {
            path: "guanliyuanead",
            component: Guanread,
            redirect: "/consumer/guanliyuanead/list",
            children: [{
                path: "list",
                component: GuanreadList ,
            },

            ],
        },


        {
            path: "TeaPage",
            component:TeaPage,
            redirect: "/consumer/TeaPage/detail",
            children: [{
                path: "detail",
                component: TeaPageList,
            },

            ],
        },


        {
            path: "GuanliTeacher",
            component:GuanliTeacher,
            redirect: "/consumer/GuanliTeacher/list",
            children: [{
                path: "list",
                component: GuanliTeacherList ,
            },

            ],
        },
        {
            path: "guanliyuanPls",
            component: GuanliyuanPls,
            redirect: "/consumer/guanliyuanPls/list",
            children: [{
                path: "list",
                component: GuanliyuanPlsList,
            },

            ],
        },
        {
            path: "guanliyuan",
            component: Guanliyuan,
            redirect: "/consumer/guanliyuan/list",
            children: [{
                    path: "list",
                    component: GuanliyuanList,
                },

            ],
        },
        {
            path: "GClass",
            component: GClass,
            redirect: "/consumer/GClass/list",
            children: [{
                path: "list",
                component: GClasslist ,
            },

            ],
        },

        {
            path: "GGread",
            component: GGread,
            redirect: "/consumer/GGread/list",
            children: [{
                path: "list",
                component: GGreadList,
            },

            ],
        },

        {
            path: "GuanUser",
            component: GuanUser,
            redirect: "/consumer/GuanUser/list",
            children: [{
                    path: "list",
                    component: GuanUserData,
                },

            ],
        },

    ],
},
    {
        path: "/admin1",
        name: "admin1",
        component: Admin,

        children: [
            {
                path: "notice",
                component: notice,
            },



            {
                path: "GuanliT",
                component: GuanliT,
                redirect: "/admin1/GuanliT/list",
                children: [{
                    path: "list",
                    component: GuanliTList,
                },

                ],
            },
            {
                path: "GuanYuedu",
                component: GuanYuedu,
                redirect: "/admin1/GuanYuedu/list",
                children: [{
                    path: "list",
                    component: GuanYueduDetail,
                },

                ],
            },
            {
                path: "GuanYueduCell",
                component:GuanYueduCell,
                redirect: "/admin1/GuanYueduCell/list",
                children: [{
                    path: "list",
                    component: GuanYueduCellList ,
                },

                ],
            },


            {
                path: "GuanUser",
                component: GuanUser ,
                redirect: "/admin1/GuanUser/list",
                children: [{
                    path: "list",
                    component: GuanUserData ,
                },

                ],
            },

            {
                path: "guanliyuan",
                component: Guanliyuan,
                redirect: "/admin1/guanliyuan/list",
                children: [{
                    path: "list",
                    component: GuanliyuanList,
                },

                ],
            },

            {
                path: "guanliyuanead",
                component: Guanread,
                redirect: "/admin1/guanliyuanead/list",
                children: [{
                    path: "list",
                    component: GuanreadList ,
                },

                ],
            },
            {
                path: "guanliyuaneadCell",
                component: guanliyuaneadCell,
                redirect: "/admin1/guanliyuaneadCell/list",
                children: [{
                    path: "list",
                    component: guanliyuaneadCellList ,
                },

                ],
            },

        ],
    },

{
    path: "/register",
    name: "register",
    component: register,
}
];

const router = new VueRouter({
    mode: "history",
    base: process.env.BASE_URL,
    routes,
});
const routerPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
    return routerPush.call(this, location).catch((error) => error);
};

// router.beforeEach((to, from, next) => {
//     // 检查前端路由 要to 的 path 是否需要进行权限认证,
//     //
//     console.log(to.path);
//     if (to.path.startsWith("/doctor")) {
//         if (!store.state.login) {
//             router.push({ path: "/login" });
//             return;
//         }
//     }
//     next();
// });
export default router;
